#ifndef CALCULATOR_H
#define CALCULATOR_H
#include <QMainWindow>
namespace Ui {
class Calculator;
}
class Calculator : public QMainWindow
{
    Q_OBJECT
public:
    explicit Calculator(QWidget *parent = 0);
    ~Calculator();
    enum FLAG_OPERATOR{
        FLAG_OPERATOR_NONE = 0,
        FLAG_OPERATOR_ADD,
        FLAG_OPERATOR_SUB,
        FLAG_OPERATOR_MUL,
        FLAG_OPERATOR_DIV
    };
private slots:
    void on_tb_num0_clicked();
    void on_tb_num1_clicked();
    void on_tb_num2_clicked();
    void on_tb_num3_clicked();
    void on_tb_num4_clicked();
    void on_tb_num5_clicked();
    void on_tb_num6_clicked();
    void on_tb_num7_clicked();
    void on_tb_num8_clicked();
    void on_tb_num9_clicked();
    void on_tb_add_clicked();
    void on_tb_equ_clicked();
    void on_tb_mul_clicked();
    void on_tb_clear_clicked();
    void on_tb_div_clicked();
    void on_tb_sub_clicked();
private:
    Ui::Calculator *ui;
    void clickedNumber(const QString &t);
    void middleResult(void);
    void model();
    bool m_firstOperator;
    QString m_value;
    QString m_leftValue;
    QString m_rightValue;
    FLAG_OPERATOR m_operator;
    QString m_expretion;
    QString m_result;
    int m_model;
};
#endif // CALCULATOR_H
